﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Globalization;

public partial class companypart_SubHistoryrep : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected override void InitializeCulture()
    {
        if (Session["CurrentCulture"] != null)
        {
            string lang = Session["CurrentCulture"].ToString();
            if (lang != null && lang != "")
            {
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang);
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang);
                Thread.CurrentThread.CurrentCulture.DateTimeFormat = new CultureInfo("en-US", false).DateTimeFormat;
                // Thread.CurrentThread.CurrentCulture.Calendar=new  System.Globalization.GregorianCalendar();

            }
        }

    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {

            string vv = ((Label)e.Row.FindControl("endofsub")).Text;
            DateTime ff = DateTime.Parse(vv);
            Label lk = (Label)e.Row.FindControl("edits");
            if (ff > DateTime.Now)
            {

                lk.Text = this.GetLocalResourceObject("lbledit").ToString();

              
            }
            else
            {

                lk.Text = this.GetLocalResourceObject("ended").ToString();
            }


        }
    }
    protected void GridView1_RowCreated1(object sender, GridViewRowEventArgs e)
    {
        //if (e.Row.RowType == DataControlRowType.DataRow)
        //{
        //    e.Row.Attributes.Add("onmouseover", "this.Mystyle=this.style.backgroundColor;this.style.backgroundColor='#FFFFA8'");

        //    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.Mystyle");
        //}
    }
    protected void genreport_Click(object sender, EventArgs e)
    {
        string myval = "";
        foreach (GridViewRow dr in GridView1.Rows)
        {
            CheckBox chk = (CheckBox)dr.FindControl("chkAdd");
            if (chk.Checked)
            {
                myval += chk.ToolTip + ",";
            }

        }
        myval = myval.Trim(",".ToCharArray()[0]);


        Response.Redirect("~/reps2.aspx?rep=" + "SubHistoryrep" + "&id=" + myval);
        // ,count(t.id) FROM [subscriptions] s INNER JOIN company_product t ON (t.company_id = s.company_id)   WHERE ([s.company_id] = @company_id) and t.enddate>getdate() group by [s.startofsub], [s.endofsub], [s.paidfees]
    }   

}
